<?php

/**
 * This is the model class for table "{{kit_categories}}".
 *
 * The followings are the available columns in table '{{kit_categories}}':
 * @property string $cat_id
 * @property string $cat_name
 * @property string $module
 * @property integer $ib_id
 * @property integer $cat_parentid
 * @property integer $order
 * @property integer $creator
 * @property integer $created
 * @property integer $editor
 * @property integer $edited
 * @property integer $recycle
 * @property integer $active
 */
class BaseKitCategories extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return KitCategories the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{kit_categories}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('cat_name, module', 'required'),
			array('ib_id, cat_parentid, order, creator, created, editor, edited, recycle, active', 'numerical', 'integerOnly'=>true),
			array('cat_name, module', 'length', 'max'=>100),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('cat_id, cat_name, module, ib_id, cat_parentid, order, creator, created, editor, edited, recycle, active', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'cat_id' => 'Cat',
			'cat_name' => 'Cat Name',
			'module' => 'Module',
			'ib_id' => 'Ib',
			'cat_parentid' => 'Cat Parentid',
			'order' => 'Order',
			'creator' => 'Creator',
			'created' => 'Created',
			'editor' => 'Editor',
			'edited' => 'Edited',
			'recycle' => 'Recycle',
			'active' => 'Active',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('cat_id',$this->cat_id,true);
		$criteria->compare('cat_name',$this->cat_name,true);
		$criteria->compare('module',$this->module,true);
		$criteria->compare('ib_id',$this->ib_id);
		$criteria->compare('cat_parentid',$this->cat_parentid);
		$criteria->compare('order',$this->order);
		$criteria->compare('creator',$this->creator);
		$criteria->compare('created',$this->created);
		$criteria->compare('editor',$this->editor);
		$criteria->compare('edited',$this->edited);
		$criteria->compare('recycle',$this->recycle);
		$criteria->compare('active',$this->active);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}